package com.jspgou.cms.manager.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jspgou.common.hibernate3.Updater;
import com.jspgou.common.page.Pagination;
import com.jspgou.cms.dao.AdspaceDao;
import com.jspgou.cms.entity.Adspace;
import com.jspgou.cms.manager.AdspaceMng;

@Service
@Transactional
public class AdspaceMngImpl implements AdspaceMng {

	public Adspace findById(Long id) {
		return dao.findById(id);
	}
	
	public List<Adspace> getList(){
		return dao.getList();
	}
	
	public List<Adspace> getListByStoreId(Long storeId,Boolean enabled){
		return dao.getListByStoreId(storeId,enabled);
	}
	
	public Pagination getPagination(Long storeId,int pageNo, int pageSize){
		return dao.getPagination(storeId, pageNo, pageSize);
	}

	public Adspace save(Adspace bean) {
		return dao.save(bean);
	}
	
	public Adspace updateByAdspacenumb(Long AdspaceId,Integer AdspaceNumb,Integer shopMemberId){
		return null;
	}

	public Adspace update(Adspace bean) {
		Updater<Adspace> updater = new Updater<Adspace>(bean);
		return dao.updateByUpdater(updater);
	}
	
	public Adspace deleteById(Long id) {
		return dao.deleteById(id);
	}

	public Adspace[] deleteByIds(Long[] ids) {
		Adspace[] beans = new Adspace[ids.length];
		for (int i = 0, len = ids.length; i < len; i++) {
			beans[i] = deleteById(ids[i]);
		}
		return beans;
	}
	
    @Autowired
    private AdspaceDao dao;
}